package com.baizhi.enumeration;

import java.util.Scanner;

public class SeasonDemo {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入季节");
        String seasonName = scan.next();

        Season s = null; //用于接受用户输入的季节

        //获取所有季节的对象
        Season[] seasons = Season.values();
        for (int i = 0; i < seasons.length; i++) {
            String name = seasons[i].getSeasonName(); //每一个季节的名字
            if(name.equals(seasonName)){
                s = seasons[i];
            }
        }


       play(s);

    }
    //不同的季节玩的内容不一样  String
    public static void play(Season s){

        switch(s){
            case SPRINT:
                System.out.println("春天，比较"+ s.getSeasonDesc() +",我放风筝");
                break;
            case SUMMER:
                System.out.println("夏天，比较"+ s.getSeasonDesc() +",游泳");
                break;
            case AUTUMN:
                System.out.println("秋天，比较"+ s.getSeasonDesc() +",野营");
                break;
            case WINTER:
                System.out.println("冬天，比较"+ s.getSeasonDesc() +",打雪仗");
                break;
        }
    }
}
